<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
    template="layout/template.xhtml">

<ui:define name="body">

    <rich:panel>
        <f:facet name="header">Device actions Details</f:facet>


        <s:decorate id="actionType" template="layout/display.xhtml">
            <ui:define name="label">Action type</ui:define>
            <h:outputText value="#{deviceActionsHome.instance.actionType}"/>
        </s:decorate>

        <s:decorate id="name" template="layout/display.xhtml">
            <ui:define name="label">Name</ui:define>
            <h:outputText value="#{deviceActionsHome.instance.name}"/>
        </s:decorate>

        <div style="clear:both"/>

    </rich:panel>

    <div class="actionButtons">

        <s:button view="/DeviceActionsEdit.xhtml"
                    id="edit"
                 value="Edit"/>

        <s:button view="/#{empty deviceActionsFrom ? 'DeviceActionsList' : deviceActionsFrom}.xhtml"
                    id="done"
                 value="Done"/>

    </div>

    <rich:tabPanel switchType="ajax">

    <rich:tab>
        <f:facet name="label">
            <h:panelGroup><h:graphicImage value="/img/manytoone.gif" style="vertical-align: middle; padding-right: 4px;"/>Device</h:panelGroup>
        </f:facet>
    <div class="association" id="deviceParent">

        <h:outputText value="There is no device associated with this deviceActions."
                   rendered="#{deviceActionsHome.instance.device == null}"/>

        <rich:dataTable var="_device"
                   value="#{deviceActionsHome.instance.device}"
                rendered="#{deviceActionsHome.instance.device != null}"
              rowClasses="rvgRowOne,rvgRowTwo"
                      id="deviceTable">
            <h:column>
                <f:facet name="header">Device id</f:facet>
                <h:outputText value="#{_device.deviceId}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Name</f:facet>
                <h:outputText value="#{_device.name}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Type</f:facet>
                <h:outputText value="#{_device.type}"/>
            </h:column>
            <h:column styleClass="action">
                <f:facet name="header">Action</f:facet>
                <s:link id="viewdevice"
                     value="View"
                      view="/Device.xhtml">
                    <f:param name="deviceDeviceId"
                           value="#{_device.deviceId}"/>
                </s:link>
            </h:column>
        </rich:dataTable>

    </div>
    </rich:tab>

    <rich:tab>
        <f:facet name="label">
            <h:panelGroup><h:graphicImage value="/img/onetomany.gif" style="vertical-align: middle; padding-right: 4px;"/>Action parameterses</h:panelGroup>
        </f:facet>
    <h:form styleClass="association" id="actionParametersesChildren">

        <h:outputText value="There are no actionParameterses associated with this deviceActions."
                   rendered="#{empty deviceActionsHome.actionParameterses}"/>

        <rich:dataTable value="#{deviceActionsHome.actionParameterses}"
                       var="_actionParameters"
                  rendered="#{not empty deviceActionsHome.actionParameterses}"
                rowClasses="rvgRowOne,rvgRowTwo"
                        id="actionParametersesTable">
            <rich:column sortBy="#{_actionParameters.actionParametersId}">
                <f:facet name="header">Action parameters id</f:facet>
                <h:outputText value="#{_actionParameters.actionParametersId}"/>
            </rich:column>
            <rich:column sortBy="#{_actionParameters.parameterName}">
                <f:facet name="header">Parameter name</f:facet>
                <h:outputText value="#{_actionParameters.parameterName}"/>
            </rich:column>
            <rich:column sortBy="#{_actionParameters.parameterValue}">
                <f:facet name="header">Parameter value</f:facet>
                <h:outputText value="#{_actionParameters.parameterValue}"/>
            </rich:column>
            <h:column>
                <f:facet name="header">Action</f:facet>
                <s:link id="selectactionParameters"
                     value="Select"
                      view="/ActionParameters.xhtml">
                    <f:param name="actionParametersActionParametersId"
                            value="#{_actionParameters.actionParametersId}"/>
                    <f:param name="actionParametersFrom" value="DeviceActions"/>
                </s:link>
            </h:column>
        </rich:dataTable>

    </h:form>

    <div class="actionButtons">
        <s:button
               value="Add actionParameters"
                view="/ActionParametersEdit.xhtml">
            <f:param name="deviceActionsDeviceActionsId"
                    value="#{deviceActionsHome.instance.deviceActionsId}"/>
            <f:param name="actionParametersFrom" value="DeviceActions"/>
        </s:button>
    </div>
    </rich:tab>

    <rich:tab>
        <f:facet name="label">
            <h:panelGroup><h:graphicImage value="/img/onetomany.gif" style="vertical-align: middle; padding-right: 4px;"/>Status actions scripts</h:panelGroup>
        </f:facet>
    <h:form styleClass="association" id="statusActionsScriptsChildren">

        <h:outputText value="There are no statusActionsScripts associated with this deviceActions."
                   rendered="#{empty deviceActionsHome.statusActionsScripts}"/>

        <rich:dataTable value="#{deviceActionsHome.statusActionsScripts}"
                       var="_statusActionsScript"
                  rendered="#{not empty deviceActionsHome.statusActionsScripts}"
                rowClasses="rvgRowOne,rvgRowTwo"
                        id="statusActionsScriptsTable">
            <rich:column sortBy="#{_statusActionsScript.statusActionsScriptId}">
                <f:facet name="header">Status actions script id</f:facet>
                <h:outputText value="#{_statusActionsScript.statusActionsScriptId}"/>
            </rich:column>
            <rich:column sortBy="#{_statusActionsScript.order}">
                <f:facet name="header">Order</f:facet>
                <h:outputText value="#{_statusActionsScript.order}"/>
            </rich:column>
            <h:column>
                <f:facet name="header">Action</f:facet>
                <s:link id="selectstatusActionsScript"
                     value="Select"
                      view="/StatusActionsScript.xhtml">
                    <f:param name="statusActionsScriptStatusActionsScriptId"
                            value="#{_statusActionsScript.statusActionsScriptId}"/>
                    <f:param name="statusActionsScriptFrom" value="DeviceActions"/>
                </s:link>
            </h:column>
        </rich:dataTable>

    </h:form>

    <div class="actionButtons">
        <s:button
               value="Add statusActionsScript"
                view="/StatusActionsScriptEdit.xhtml">
            <f:param name="deviceActionsDeviceActionsId"
                    value="#{deviceActionsHome.instance.deviceActionsId}"/>
            <f:param name="statusActionsScriptFrom" value="DeviceActions"/>
        </s:button>
    </div>
    </rich:tab>
</rich:tabPanel>
</ui:define>

</ui:composition>
